
public class SwapTest {

    public Integer a;
    public Integer b;

    void swap() {
        Integer c = a;
        a = b;
        b = c;
    }

    public static void swap (Integer a, Integer b) {
        Integer c = a.intValue();
        a = b.intValue();
        b = c;
    }

    /**
     * @param args
     *
     * @author grind
     * @date Feb 27, 2014 5:54:12 PM
     */
    public static void main(String[] args){
        SwapTest sw = new SwapTest();
        sw.a = 3;
        sw.b = 4;
        sw.swap();
        System.out.println("a = " + sw.a);
        System.out.println("b = " + sw.b);

        Integer a = 3;
        Integer b = 4;
        swap(a,b);
        System.out.println("a = " + a);
        System.out.println("b = " + b);
    }

}
